/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __FLGR_CORE_THREADS_H
#define __FLGR_CORE_THREADS_H
  
#include <flgrCoreDll.h>
#include <flgrCoreTypes.h>
#include <flgrCoreErrors.h>
#include <flgrCoreData.h>

  /*!
   * \addtogroup group_fulguro_core_thread
   * @{
   */

  /*! 
   *  Pointer to a threaded function
   */
  typedef int (*FLGR_ThreadFunction)    (void *param); 

  /*! 
   *  Thread Argument Structure
   */
  typedef struct {
    int argc;             /*!< number of argument of the thread */
    void **argv;          /*!< array of pointer to argument of the thread */
  }FLGR_ThreadsArg;

  /*! 
   *  List of Thread Argument Structure
   */
  typedef struct {
    int threads_nb;                 /*!< number of threads */
    FLGR_ThreadsArg **threads_arg;  /*!< array of pointer to FLGR_ThreadArg */
  }FLGR_ThreadsArgList;


  //! @}

  EXPORT_LIB FLGR_ThreadsArgList* flgr_threads_create_argument_list(int threads_nb);

  EXPORT_LIB void flgr_threads_set_argument(FLGR_ThreadsArgList* arglist, int thread_index, ...);

  EXPORT_LIB void flgr_threads_destroy_argument_list(FLGR_ThreadsArgList *arglist);

  EXPORT_LIB FLGR_Ret flgr_threads_start(FLGR_ThreadsArgList *arglist, 
					 int threads_nb_per_fct, int threads_fct_nb, ...);






  typedef FLGR_Ret *(FLGR_2D_fptr_data2d_data2d_nhb)(FLGR_Data2D *, FLGR_Data2D *, FLGR_Data2D *);



#endif

#ifdef __cplusplus
}
#endif
